<template>
  <div>
    <div v-if="flag == 0">
      <div style="margin-left: 10px; padding-top: 10px">
        <el-form class="demo-form-inline" :inline="true" :model="formInline">
          <el-form-item label="医生">
            <el-input v-model="formInline.user" placeholder="医生" />
          </el-form-item>
          <el-form-item label="用户">
            <el-input v-model="formInline.user" placeholder="用户" />
          </el-form-item>
          <el-form-item label="科室">
            <el-input v-model="formInline.user" placeholder="科室" />
          </el-form-item>
          <el-form-item label="自备自购药方">
            <el-input
              v-model="formInline.user"
              placeholder="自备自购药方
"
            />
          </el-form-item>
          <el-form-item
            label="创建月份
"
          >
            <el-input
              v-model="formInline.user"
              placeholder="创建月份
"
            />
          </el-form-item>

          <el-form-item>
            <el-button type="primary">查询</el-button>
          </el-form-item>
        </el-form>
      </div>

      <el-table :data="tableData" style="width: 100%">
        <el-table-column label="用户姓名" prop="app_customer_name" />
        <el-table-column label="预约日期" prop="res_date">
          <template slot-scope="scope">
            <div>
              {{ scope.row.res_date }}
              <br />
              {{ scope.row.res_time }}
            </div>
          </template>
        </el-table-column>
        <el-table-column label="出生日期" prop="birthday" />
        <el-table-column label="用户年龄" prop="age" />
        <el-table-column label="性别" prop="gender" />
        <el-table-column label="预约医生" prop="user_name" />
        <el-table-column label="状态" prop="res_item_status_name">
          <template slot-scope="scope">
            <!--  -->
            <el-tag v-if="scope.row.res_item_status == 'res_ended'" type="info">
              {{ scope.row.res_item_status_name }}
            </el-tag>
            <el-tag v-else>
              {{ scope.row.res_item_status_name }}
            </el-tag>
          </template>
        </el-table-column>
        <el-table-column label="操作" prop="address">
          <template slot-scope="scope">
            <el-button
              v-permissions="{ permission: ['detail:Receive'] }"
              type="primary"
              @click="see(scope.row)"
            >
              查看
            </el-button>
          </template>
        </el-table-column>
      </el-table>
    </div>
    <div v-if="flag == 1">
      <SeeReceive :see-list="seeList" @box="box" />
    </div>
  </div>
</template>

<script>
  import { reciveReceptionList } from '@/api/reservation'

  // import { getSchedulingLists } from '@/api/scheduling'
  // import { getUserList } from '@/api/public'

  export default {
    components: {
      SeeReceive: () => import('./components/seeReceive.vue'),
    },
    data() {
      return {
        flag: 0,
        formInline: {},
        tableData: [],
        datas: [],
        seeList: {},
      }
    },
    mounted() {
      this.init()
    },

    beforeMount() {},
    methods: {
      init() {
        reciveReceptionList().then((e) => {
          this.tableData = e.data
        })
      },
      see(e) {
        this.seeList = e
        this.flag = 1
      },
      box() {
        this.flag = 0
      },
    },
  }
</script>

<style scoped></style>
